package cn.wolfcode.trip.api.controller;

import cn.wolfcode.trip.base.domain.Survey;
import cn.wolfcode.trip.base.service.ISurveyService;
import cn.wolfcode.trip.base.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/surveies")
public class SurveyController {

    @Autowired
    private ISurveyService surveyService;

    @RequestMapping
    public JsonResult save(Survey survey)
    {
        JsonResult result = new JsonResult();
        try {
            surveyService.insert(survey);
        } catch (Exception e){
            result.mark(e.getMessage());
        }
        return result;
    }

}
